#include <qlabel.h>
#include <qtextedit.h>
#include <qtimer.h>
#include <qlineedit.h>
#include "xqnowmwidget.h"
#include <tws_debugging.h>
#include <xwritelogexport.h>
#include <xinifile.h>

class QTimer;

XQnoWmWidget::XQnoWmWidget(QWidget* parent, Qt::WFlags fl)
		: QWidget(parent,Qt::FramelessWindowHint),m_qnumber(0),m_isShowQno(false)
{
	m_lbQnoShow = new QLabel(this);
}

int XQnoWmWidget::setupUi(int in_layout)
{
	if (0!=m_iniLayout.open(k_iniLayoutQnoWm.c_str()))
	  LOG_E("[Error] Cannot find ini file");
	RIF(true!= m_iniLayout.setProperties(this, k_iniSecFullScreen.c_str()));
	RIF(true!= m_iniLayout.setProperties(m_lbQnoShow, k_iniSecQnoShow.c_str()));
	QPalette p = m_lbQnoShow->palette();
	p.setBrush(m_lbQnoShow->backgroundRole(), QBrush(QImage(k_backgroundImageBlue)));
	m_lbQnoShow->setPalette(p);
	return 0;
}
void XQnoWmWidget::showQ(uint32_t in_qnumber)
{
	m_qnumber = in_qnumber;
	m_lbQnoShow->setNum((int)m_qnumber);
	m_lbQnoShow->show();
}

void XQnoWmWidget::switchBackground(QString in_file)
{
	QPalette p = m_lbQnoShow->palette();
	p.setBrush(m_lbQnoShow->backgroundRole(), QBrush(QImage(in_file)));
	m_lbQnoShow->setPalette(p);
	m_lbQnoShow->show();
}
